<template>
      <el-tabs v-model="activedName">
        <el-tab-pane label="个人所得税" name="first">
          <type-table :type="1" />
        </el-tab-pane>
        <el-tab-pane label="个人经营所得税" name="second">
          <type-table :type="3" />
        </el-tab-pane>
      </el-tabs>
</template>

<script>
/**
 * @file 一键报税
 */
import typeTable from "./typeTable";
import utiles from '@/components/utiles';

export default {
  components: {
    typeTable,
  },
  data() {
    return {
      activedName: "first",
      processStatisticsData: {},
      statisticItems: 
                    [
                      {
                      title:"申报环节",
                      subItems:["待申报", "申报中","申报失败"],
                      },
                      {
                        title:"客户确认环节",
                        subItems: ["申报成功(待客户确认)","确认中", "人工处理"]
                      },
                      {
                        title:"缴纳环节",
                        subItems: ["缴纳中", "缴纳成功","无三方协议"]
                      },
                    ],
    };
  },
  mounted() {
    this.loadData();
  },
  methods: {
    handleClick(tab, event) {
    },
      percent(originmap, title){
    console.log("percent:", title, originmap);
    if(originmap.get(title) == undefined){
      return 0;
    } else {
      return originmap.get(title)[0]
    }
  },
  number(originmap, title){
    if(originmap.get(title) == undefined){
      return 0;
    } else {
      return originmap.get(title)[1]
    }
  },
  round4Remain2(number){
    return Math.round(number*100) / 100;
  },
  async loadData() {
  var myDate = new Date();
  var tYear = myDate.getFullYear();
  var tMonth = myDate.getMonth();
  var m = tMonth + 1;
  if (m.toString().length == 1) {
      m = "0" + m;
  }
  const currentUser = utiles.getCurrentUser();
  var params = {
      bName:currentUser.bCompanyName,
      type: 1
  }
  const res = await this.$http.get('/incomeTax/statistics', {params: params})
  if (res.code !== 0) return this.$message.error(res.message);
    console.log("statis:", res.data)
  let sum = 0;
  res.data.forEach(element => {
      sum += element.number
  });

  var statisList = res.data.map(item => {
      return [item.name, [Math.round(item.number/sum * 1000000) / 10000, item.number]]
  });
}
  },
};
</script>

<style lang="less" scoped>
.one-key-bill {
  padding: 0 10px;
  .top-line {
    padding-bottom: 10px;
  }
  .pagination {
    text-align: right;
    padding: 20px 0 0;
  }
}
</style>
